#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "package.h"
#include "guidesystem.h"
#include "initPoint.h"
#include "initArc.h"
#include <QMainWindow>
#include <QTimer>
#include <QFile>
#include <QPushButton>
#include <QLabel>
#include <QListWidget>
#include <QCloseEvent>
#include "surroundingsWidget.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    package * pkg = new package;
    QLabel *timeLbl = new QLabel(this);
    QLabel *addressLbl = new QLabel(this);
    QTimer *timer = new QTimer(this);
    guideSystem * guider = new guideSystem(pkg);
    QFile logFile;
    surroundingsWidget *surWidget = new surroundingsWidget;
    QPixmap *pix;
    QPainter *painter;
    initPoint *initP = new initPoint;
    initArc *initA = new initArc;

    bool debug = false;
    double startTime, endTime;

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void CheckLog();
    void SendLog(QString str);
    void ConnectBackBtn(QPushButton *btn);
    QString StringCampus();
    QString StringCampus(int campus);
    void SetWaypointsTxt();
    bool KMP(QString ts, QString ps);
    QList<int> GetNext(QString ps);
    QList<QString> Matching(QLineEdit *line);
    void ConnectSearchBtn(QPushButton *btn, QListWidget *list);
    void ConnectConfirmBtn(QPushButton *btn);
    void guiderCampus();
    void SetPage5();
    void PaintLable();
    int TrueMsecsTo(QTime startTime, QTime endTime);
    void Motion();
    void StringFeatherArrow(QString *feather, QString *arrow);
    virtual void mouseReleaseEvent(QMouseEvent *ev);

signals:
    /**
     * @brief 用于给窗口发送pkg
     * @param pkg
     */
    void SendPkg(package * pkg);

    /**
     * @brief 初始化时发送点
     */
    void SendPoint(int x, int y, int campus);

    /**
     * @brief 初始化时发送道路两点
     */
    void SendArc(int x1, int y1, int x2, int y2, int campus, myGraph *graph);

private slots:
    void GetSrdNum(int num);

protected:
    void closeEvent(QCloseEvent *);

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H	#endif // MAINWINDOW_H
